package com.anjubao.parking.municipal.parkinglot.service;

import com.anjubao.parking.municipal.parkinglot.mapper.ParkingLotDeviceVideoPileSlotMapper;
import com.anjubao.parking.municipal.parkinglot.model.ParkingLotDeviceVideoPileSlot;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 
 * ParkingLot服务实现类
 * 
 * @author chenfang
 *
 */
@Service
@Slf4j
public class ParkingLotDeviceVideoPileSlotService extends ServiceImpl<ParkingLotDeviceVideoPileSlotMapper, ParkingLotDeviceVideoPileSlot> {

	@Autowired
	private ParkingLotDeviceVideoPileSlotMapper parkingLotDeviceVideoPileSlotMapper;


    @Transactional(rollbackFor = Exception.class)
    public void saveVideoPileSlot(List<ParkingLotDeviceVideoPileSlot> videoPileSlots) {
        saveBatch(videoPileSlots,videoPileSlots.size());
    }



    public void insertSlotsBatch(List<ParkingLotDeviceVideoPileSlot> videoPileSlots) {
        parkingLotDeviceVideoPileSlotMapper.insertSlotsBatch(videoPileSlots);
    }

    /**
     * 根据车场code获取安装了视频桩的泊位id列表
     * @param parkingLotCode
     * @return
     */
    public List<Long> selectVideo(String parkingLotCode) {
        return parkingLotDeviceVideoPileSlotMapper.selectVideo(parkingLotCode);
    }
}
